﻿using ArcGIS.Desktop.Core.Geoprocessing;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Baci.Net.ToolKit.ArcGISProGeoprocessor.Models
{
    //
    // 摘要:
    //     The interface required by processes intended for use with the Geoprocessor.
    public interface IGPProcess
    {
        ////
        //// 摘要:
        ////     The directory of the toolbox containing the tool from which this process was
        ////     generated.
        //string ToolboxDirectory { get; }

        /// <summary>
        /// The name of the toolbox containing the tool from which this process was generated.
        /// </summary>
        string ToolboxName { get; }

        /// <summary>
        /// The name of the tool from which this process was generated.
        /// </summary>
        string ToolName { get; }

        ///// <summary>
        ///// The alias of the toolbox containing the tool from which this process was generated.
        ///// </summary>
        //string Alias { get; }

        /// <summary>
        /// 调用工具的字符串 ArcGIS Pro SDK中调用的格式 ({toolBoxAliasName}.{ToolName}) ArcGIS Engine调用的格式 ({ToolName}_{ToolBoxAliasName})
        /// </summary>
        string CallName { get; }

        /// <summary>
        /// 已设置的环境变量
        /// </summary>
        IEnumerable<KeyValuePair<string, string>> Environments { get; }

        /// <summary>
        /// For public use only, do not modify.
        /// </summary>
        object[] ParameterInfo { get; }
    }

    public static partial class Extension
    {

        public static IReadOnlyList<string> GetGPValue<T>(this List<T> enums) where T : Enum
        {
            return Geoprocessing.MakeValueArray(enums.Select(c => c.GetGPValue()).ToArray());
        }

        public static IReadOnlyList<string> GetGPValue(this List<object> enums)
        {
            return Geoprocessing.MakeValueArray(enums.Select(c => c).ToArray());
        }
    }
}
